package promote.brozen.spring.lifecycle;

import lombok.extern.slf4j.Slf4j;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;

import java.util.concurrent.locks.LockSupport;

/**
 * @author Brozen
 * @date 2020/8/30 9:55 PM
 * @email brozen@qq.com
 */
@Slf4j
@Configuration
@ComponentScan(basePackageClasses = LifecycleTest.class)
public class LifecycleTest {

    public static void main(String[] args) {
        ApplicationContext applicationContext = new AnnotationConfigApplicationContext(LifecycleTest.class);
        System.out.println(applicationContext.getDisplayName());

//        applicationContext.getBean(JustABean.class);
        LockSupport.park();
    }

    @Bean
    public MyBeanPostProcessor myBeanPostProcessor() {
        return new MyBeanPostProcessor("justABean");
    }

    @Bean
    public MyBeanFactoryPostProcessor myBeanFactoryPostProcessor() {
        return new MyBeanFactoryPostProcessor();
    }

}
